# import hou
import socket


# def sub(*args):
#     key = hou.pwd().parm('key').evalAsString()
#     com = hou.pwd().parm('command').evalAsString()
#     HOST = '180.76.173.132'
#     PORT = 9527
#     BUFFER = 4096
#     sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
#     sock.connect((HOST, PORT))
#     sock.send(key + com)
#
#     res = sock.recv(BUFFER)
#     back = res.decode('utf8')
#     if back.startswith('MZdo'):  # do action
#         re = eval(back[4:])
#     else:  # chat
#         eval('print' + recv)


def send():
    # HOST = '192.168.0.113'
    # HOST='127.0.0.1'
    HOST = '192.168.53.3'
    PORT = 2020
    BUFFER = 4096
    test_data={'type':'box','size':10,'distance':50,'color':'#000000'}
    sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    sock.connect((HOST, PORT))

    sock.send(str(test_data).encode('utf8'))

    res = sock.recv(BUFFER)
    # back = res.decode('utf8')
    print(res)
    sock.close()
    # if back.startswith('MZdo'):  # do action
    #     re = eval(back[4:])
    # else:  # chat
    #     eval('print' + recv

send()